<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Contributing to pgmpy &#8212; pgmpy 0.1.2 documentation</title>
    
    <link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true,
        SOURCELINK_SUFFIX: '.txt'
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="Estimators for Parameter and Structure Learning" href="estimators.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="estimators.html" title="Estimators for Parameter and Structure Learning"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">pgmpy 0.1.2 documentation</a> &#187;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/logo.png" alt="Logo"/>
            </a></p>
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Contributing to pgmpy</a><ul>
<li><a class="reference internal" href="#code-and-issues">Code and Issues</a></li>
<li><a class="reference internal" href="#git-and-our-branching-model">Git and our Branching model</a></li>
<li><a class="reference internal" href="#git">Git</a></li>
<li><a class="reference internal" href="#forks-github-pull-requests">Forks + GitHub Pull requests</a></li>
<li><a class="reference internal" href="#tips">Tips</a></li>
<li><a class="reference internal" href="#code-guidelines">Code Guidelines</a></li>
<li><a class="reference internal" href="#tests">Tests</a></li>
<li><a class="reference internal" href="#discussion">Discussion</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="estimators.html"
                        title="previous chapter">Estimators for Parameter and Structure Learning</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/contributing.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="contributing-to-pgmpy">
<h1>Contributing to pgmpy<a class="headerlink" href="#contributing-to-pgmpy" title="Permalink to this headline">¶</a></h1>
<p>Hi! Thanks for your interest in contributing to [pgmpy](pgmpy — pgmpy 0.1.0 documentation) :D .
In this document we&#8217;ll try to summarize everything that you need to know to do a good job.</p>
<div class="section" id="code-and-issues">
<h2>Code and Issues<a class="headerlink" href="#code-and-issues" title="Permalink to this headline">¶</a></h2>
<p>We use [Github](<a class="reference external" href="https://github.com/pgmpy/pgmpy">https://github.com/pgmpy/pgmpy</a>) to host our code repositories
and issues.You can look at [issues](<a class="reference external" href="https://github.com/pgmpy/pgmpy/issues">https://github.com/pgmpy/pgmpy/issues</a>) to report any
issues related to pgmpy. Here is a [guide](<a class="reference external" href="https://guides.github.com/features/issues/">https://guides.github.com/features/issues/</a>)
on how to report better issues.</p>
</div>
<div class="section" id="git-and-our-branching-model">
<h2>Git and our Branching model<a class="headerlink" href="#git-and-our-branching-model" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="git">
<h2>Git<a class="headerlink" href="#git" title="Permalink to this headline">¶</a></h2>
<p>We use [Git](<a class="reference external" href="http://git-scm.com/">http://git-scm.com/</a>) as our [version control
system](<a class="reference external" href="http://en.wikipedia.org/wiki/Revision_control">http://en.wikipedia.org/wiki/Revision_control</a>), so the best way to
contribute is to learn how to use it and put your changes on a Git repository.
There are plenty of documentation about Git &#8211; you can start with the [Pro Git
book](<a class="reference external" href="http://git-scm.com/book/">http://git-scm.com/book/</a>).
Or You can go through the [try git tutorial](<a class="reference external" href="https://try.github.io/levels/1/challenges/1">https://try.github.io/levels/1/challenges/1</a>
)</p>
</div>
<div class="section" id="forks-github-pull-requests">
<h2>Forks + GitHub Pull requests<a class="headerlink" href="#forks-github-pull-requests" title="Permalink to this headline">¶</a></h2>
<p>We use the famous
[gitflow](<a class="reference external" href="http://nvie.com/posts/a-successful-git-branching-model/">http://nvie.com/posts/a-successful-git-branching-model/</a>) to manage our
branches.</p>
<p>Summary of our git branching model:
- Fork the desired repository on GitHub to your account;
- Clone your forked repository locally</p>
<blockquote>
<div>(<cite>git clone git&#64;github.com:your-username:repository-name.git</cite>);</div></blockquote>
<ul class="simple">
<li>Create a new branch off of <cite>develop</cite> with a descriptive name (for example:
<cite>feature/portuguese-sentiment-analysis</cite>, <cite>hotfix/bug-on-downloader</cite>). You can
do it by switching to <cite>develop</cite> branch (<cite>git checkout develop</cite>) and then
creating a new branch (<cite>git checkout -b name-of-the-new-branch</cite>);</li>
<li>Do many small commits on that branch locally (<cite>git add files-changed</cite>,
<cite>git commit -m &#8220;Add some change&#8221;</cite>);</li>
<li>Push to your fork on GitHub (with the name as your local branch:
<cite>git push origin branch-name</cite>);</li>
<li>Create a pull request using the GitHub Web interface (asking us to pull the
changes from your new branch and add the changes to our <cite>develop</cite> branch);</li>
<li>Wait for comments.</li>
</ul>
</div>
<div class="section" id="tips">
<h2>Tips<a class="headerlink" href="#tips" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>Write [helpful commit
messages](<a class="reference external" href="http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message">http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message</a>).</li>
<li>Anything in the <cite>dev</cite> branch should be deployable (no failing tests).</li>
<li>Never use <cite>git add .</cite>: it can add unwanted files;</li>
<li>Avoid using <cite>git commit -a</cite> unless you know what you&#8217;re doing;</li>
<li>Check every change with <cite>git diff</cite> before adding then to the index (stage
area) and with <cite>git diff &#8211;cached</cite> before commiting;</li>
<li>If you have push access to the main repository, please do not commit directly
to <cite>dev</cite>: your access should be used only to accept pull requests; if you
want to make a new feature, you should use the same process as other
developers so that your code can be reviewed.</li>
</ul>
</div>
<div class="section" id="code-guidelines">
<h2>Code Guidelines<a class="headerlink" href="#code-guidelines" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>We use [PEP8](<a class="reference external" href="http://www.python.org/dev/peps/pep-0008/">http://www.python.org/dev/peps/pep-0008/</a>);</li>
<li>We permit 120 characters in a line, rather 79 as suggested in PEP8</li>
<li>Write tests for your new features (please see &#8220;Tests&#8221; topic below);</li>
<li>Always remember that [commented code is dead
code](<a class="reference external" href="http://www.codinghorror.com/blog/2008/07/coding-without-comments.html">http://www.codinghorror.com/blog/2008/07/coding-without-comments.html</a>);</li>
<li>Name identifiers (variables, classes, functions, module names) with readable
names (<cite>x</cite> is always wrong);</li>
<li>When manipulating strings, use [Python&#8217;s new-style
formatting](<a class="reference external" href="http://docs.python.org/library/string.html#format-string-syntax">http://docs.python.org/library/string.html#format-string-syntax</a>)
(<cite>&#8216;{} = {}&#8217;.format(a, b)</cite> instead of <cite>&#8216;%s = %s&#8217; % (a, b)</cite>);</li>
<li>When working with files use <cite>with open(&lt;filename&gt;, &lt;option&gt;) as f</cite> instead of
` f = open(&lt;filename&gt;, &lt;option&gt;)`;</li>
<li>All <cite>#TODO</cite> comments should be turned into issues (use our
[GitHub issue system](<a class="reference external" href="https://github.com/pgmpy/pgmpy/issues">https://github.com/pgmpy/pgmpy/issues</a>));</li>
<li>Run all tests before pushing (just execute <cite>nosetests</cite>) so you will know if your
changes broke something;</li>
<li>Try to write both Python 2 and Python3-friendly code so won&#8217;t be a pain for
us to support both versions.We use [six](<a class="reference external" href="https://pypi.python.org/pypi/six">https://pypi.python.org/pypi/six</a>) to help
us in integration across various python versions.</li>
</ul>
</div>
<div class="section" id="tests">
<h2>Tests<a class="headerlink" href="#tests" title="Permalink to this headline">¶</a></h2>
<p>We use [Travis CI](<a class="reference external" href="https://travis-ci.org/">https://travis-ci.org/</a>) for continous integration
and python [unittest module](<a class="reference external" href="https://docs.python.org/2/library/unittest.html">https://docs.python.org/2/library/unittest.html</a>) for writing tests.
You should write tests for every feature you add or bug you solve in the code.
Having automated tests for every line of our code let us make big changes
without worries: there will always be tests to verify if the changes introduced
bugs or lack of features. If we don&#8217;t have tests we will be blind and every
change will come with some fear of possibly breaking something.</p>
<p>For a better design of your code, we recommend using a technique called
[test-driven development](<a class="reference external" href="https://en.wikipedia.org/wiki/Test-driven_development">https://en.wikipedia.org/wiki/Test-driven_development</a>),
where you write your tests <strong>before</strong> writing the actual code that implements
the desired feature.</p>
</div>
<div class="section" id="discussion">
<h2>Discussion<a class="headerlink" href="#discussion" title="Permalink to this headline">¶</a></h2>
<p>Please feel free to contact us through mail list if
you have any questions or suggestions.
Connect with us at [gitter](<a class="reference external" href="https://gitter.im/pgmpy/pgmpy">https://gitter.im/pgmpy/pgmpy</a>).
Every contribution is very welcome!</p>
<p><em>Mailing list</em> : <a class="reference external" href="mailto:pgmpy&#37;&#52;&#48;googlegroups&#46;com">pgmpy<span>&#64;</span>googlegroups<span>&#46;</span>com</a></p>
<p>Happy hacking! ;)</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="estimators.html" title="Estimators for Parameter and Structure Learning"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">pgmpy 0.1.2 documentation</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2016, Ankur Ankan.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.5.1.
    </div>
  </body>
</html>